﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using IQKS.AWP.BusinessObject;
using System.Data;

namespace IQKS.AWP.DataAccessLayer
{
    public class CandidateAllocateAssessorDAL
    {
          public object SetCandidateAllocateAssessor(CandidateAllocateAssessorBO param)
        {
            try
            {

                SqlParameter[] parameters = new SqlParameter[]
			{
                new SqlParameter("@ModeratorID",param.ModeratorID),
                new SqlParameter("@ResearchLeadID",param.ResearchLeadID),
                new SqlParameter("@AuditorID ",param.AuditorID),
                new SqlParameter("@IndustryExpertID",param.IndustryExpertID),
                new SqlParameter("@ModeratorFees",param.ModeratorFees),
                new SqlParameter("@ResearchLeadFees",param.ResearchLeadFees),
                new SqlParameter("@AuditorFees",param.AuditorFees),
                new SqlParameter("@IndustryExpertFees",param.IndustryExpertFees),
                new SqlParameter("@CandidateID",param.CandidateID),
                new SqlParameter("@UserID",param.UserID),
				
              
			};
                return DataUtils.ExecuteScalar("Usp_SetCandidateAllocateAssessor", parameters);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
          public object SetCandidateAllocatedAssessor(CandidateAllocateAssessorBO param, string EncryptedCandidateID, string ApproveStatusID, string RejectStatusID)
        {
            try
            {

                SqlParameter[] parameters = new SqlParameter[]
                {
                new SqlParameter("@ModeratorID",param.ModeratorID),
                new SqlParameter("@ResearchLeadID",param.ResearchLeadID),
                new SqlParameter("@AuditorID ",param.AuditorID),
                new SqlParameter("@IndustryExpertID",param.IndustryExpertID),
                new SqlParameter("@IQKSManagerID",param.IQKSManagerID),
                new SqlParameter("@ModeratorFees",param.ModeratorFees),
                new SqlParameter("@ResearchLeadFees",param.ResearchLeadFees),
                new SqlParameter("@AuditorFees",param.AuditorFees),
                new SqlParameter("@IndustryExpertFees",param.IndustryExpertFees),
                new SqlParameter("@IQKSManagerFees",param.IQKSManagerFees),
                
                new SqlParameter("@TotalOutofExpenses",param.TotalOutExpenses),
                new SqlParameter("@PortalAdministrationExpenses",param.PortalAdministrationExpenses),
                new SqlParameter("@CurrencyTypeID",param.CurrencyTypeID),
                new SqlParameter("@CurrencyDate",param.CurrencyDate),
                new SqlParameter("@CurrencyRate",param.CurrencyRate),
                new SqlParameter("@TotalFees",param.TotalFees),
                new SqlParameter("@GrossTotalFees",param.GrossTotalFees),
                new SqlParameter("@PortalAdministrationRemark",param.PortalAdministrationRemark),

                new SqlParameter("@CandidateID",param.CandidateID),
                new SqlParameter("@UserID",param.UserID),
                new SqlParameter("@EncryptedCandidateID",EncryptedCandidateID),
                new SqlParameter("@ApproveStatusID",ApproveStatusID),
                new SqlParameter("@RejectStatusID",RejectStatusID),

                new SqlParameter("@AssessorLocalFeesCurrency",param.AssessorLocalFeesCurrency),
                new SqlParameter("@AssessorLocalFeesAmount",param.AssessorLocalFeesAmount),
                new SqlParameter("@AssessorLocalFees",param.AssessorLocalFees),
                new SqlParameter("@AssessorLocationFeesAmount",param.AssessorLocationFeesAmount),
                new SqlParameter("@AssessorLocation",param.AssessorLocation),
                
				/*
                @ModeratorID
                @ResearchLeadID
                @AuditorID
                @IndustryExpertID
                @IQKSManagerID
                @ModeratorFees
                @ResearchLeadFees
                @AuditorFees
                @IndustryExpertFees
                @IQKSManagerFees
                @TotalOutofExpenses
                @PortalAdministrationExpenses
                @CurrencyTypeID
                @CurrencyDate
                @CurrencyRate
                @TotalFees
                @GrossTotalFees
                @CandidateID
                @UserID*/

              
                };
                return DataUtils.ExecuteScalar("Usp_SetCandidateAllocatedAssessor", parameters);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }

        public object SetAssessorDocument(params object[] param)
        {
            try
            {
                return DataUtils.ExecuteScalar("Usp_SetAssessorDocument", param);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }

        public DataSet GetAssessorDocument(params object[] param)
        {
            DataSet objDs;

            try
            {
                objDs = DataUtils.ExecuteDataset("Usp_GetAssessorDocumentByDocumentType", param);

            }
            catch (Exception exception)
            {
                throw new ApplicationException(exception.Message);
            }
            return objDs;
        }

        public object SetCandidateAllocatedToCandidate(CandidateAllocateAssessorBO param)
        {
                try
                {

                    SqlParameter[] parameters = new SqlParameter[]
                    {
                        new SqlParameter("@CandidateID",param.CandidateID),
                        new SqlParameter("@UserID",param.UserID),
				        new SqlParameter("@CandidateStatus",param.CandidateStatusID),
                        new SqlParameter("@CandidateView",param.CandidateView),
                    };
                    return DataUtils.ExecuteScalar("Usp_SetCandidateAllocatedToCandidate", parameters);
                }
                catch (Exception ex)
                {
                    throw new ApplicationException(ex.Message);
                }
        }
        public DataSet GetAllAssessor(params object[] param)
            {
                DataSet objDs;

                try
                {
                    objDs = DataUtils.ExecuteDataset("USP_GetAllAssessor", param);

                }
                catch (Exception exception)
                {
                    throw new ApplicationException(exception.Message);
                }
                return objDs;
            }


        public DataSet GetPartnerAssessor(params object[] param)
        {
                DataSet objDs;

                try
                {
                    objDs = DataUtils.ExecuteDataset("Usp_GetPartnerAssessorDetail", param);

                }
                catch (Exception exception)
                {
                    throw new ApplicationException(exception.Message);
                }
                return objDs;
        }

        
    }
}
